home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin MDIForm MainForm
- Caption = "Mabry FTP Sample Program"
- ClientHeight = 8040
- ClientLeft = 3795
- ClientTop = 1485
- ClientWidth = 7365
- Height = 8445
- Left = 3735
- LinkTopic = "MDIForm1"
- Top = 1140
- Width = 7485
- Begin PictureBox Picture2
- Align = 2 'Align Bottom
- BackColor = &H00C0C0C0&
- Height = 405
- Left = 0
- ScaleHeight = 375
- ScaleWidth = 7335
- TabIndex = 6
- Top = 7635
- Width = 7365
- Begin Label Label7
- BackColor = &H00C0C0C0&
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 225
- Left = 6210
- TabIndex = 14
- Top = 105
- Width = 840
- End
- Begin Label Label1
- Alignment = 1 'Right Justify
- BackColor = &H00C0C0C0&
- Caption = "Progress:"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 225
- Left = 5040
- TabIndex = 13
- Top = 105
- Width = 1050
- End
- Begin Label lblLastAction
- BackColor = &H00C0C0C0&
- Caption = "Label2"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 255
- Left = 1065
- TabIndex = 12
- Top = 105
- Width = 375
- End
- Begin Label lblLastError
- BackColor = &H00C0C0C0&
- Caption = "Label2"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 255
- Left = 3585
- TabIndex = 11
- Top = 105
- Width = 975
- End
- Begin Label lblState
- BackColor = &H00C0C0C0&
- Caption = "Label2"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 255
- Left = 2145
- TabIndex = 10
- Top = 105
- Width = 615
- End
- Begin Label Label3
- Alignment = 1 'Right Justify
- BackColor = &H00C0C0C0&
- Caption = "Last Action:"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 255
- Left = 105
- TabIndex = 9
- Top = 105
- Width = 855
- End
- Begin Label Label4
- Alignment = 1 'Right Justify
- BackColor = &H00C0C0C0&
- Caption = "Last Error:"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 255
- Left = 2625
- TabIndex = 8
- Top = 105
- Width = 855
- End
- Begin Label Label5
- Alignment = 1 'Right Justify
- BackColor = &H00C0C0C0&
- Caption = "State:"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 255
- Left = 1425
- TabIndex = 7
- Top = 105
- Width = 615
- End
- End
- Begin PictureBox Picture1
- Align = 1 'Align Top
- BackColor = &H00C0C0C0&
- BorderStyle = 0 'None
- Height = 3975
- Left = 0
- ScaleHeight = 3975
- ScaleWidth = 7365
- TabIndex = 0
- Top = 0
- Width = 7365
- Begin mFTP FTP1
- Account = ""
- AllocBytes = 0
- Blocking = 0 'False
- Debug = 1 'Enabled
- Directory = ""
- Host = ""
- Left = 4320
- Pattern = ""
- Port = 21
- Timeout = 60
- Top = 3450
- Type = 1 'Binary
- End
- Begin Timer Timer1
- Interval = 100
- Left = 5085
- Top = 3495
- End
- Begin CommandButton cmdFileTransfers
- Caption = "File Transfers"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Left = 2685
- TabIndex = 5
- Top = 3480
- Width = 1275
- End
- Begin CommandButton cmdConnection
- Caption = "Connection"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Left = 135
- TabIndex = 4
- Top = 3480
- Width = 1275
- End
- Begin CommandButton cmdDirectory
- Caption = "Directory"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Left = 1410
- TabIndex = 3
- Top = 3480
- Width = 1275
- End
- Begin ListBox listDir
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "Courier New"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 1080
- Left = 150
- TabIndex = 2
- Top = 1830
- Width = 7005
- End
- Begin ListBox listTrace
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "Courier New"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 1080
- Left = 165
- TabIndex = 1
- Top = 255
- Width = 6990
- End
- End
- Option Explicit
- Dim frmLoaded As Form
- Dim cmdCurrent As CommandButton
- Dim fIgnoreListDirClick As Integer
- Private Sub cmdConnection_Click ()
- LoadForm frmConnection, cmdConnection
- End Sub
- Private Sub cmdDirectory_Click ()
- LoadForm frmDirectory, cmdDirectory
- End Sub
- Private Sub cmdFileTransfers_Click ()
- LoadForm frmFileTransfers, cmdFileTransfers
- End Sub
- Sub FTP1_AsyncError (ErrorCode As Integer, ErrorMsg As String)
- Trace MainForm.listTrace, "Async Error:" & Str(ErrorCode) & " " & ErrorMsg
- End Sub
- Sub FTP1_Connected (fConnected As Integer)
- Debug.Print "connected " & fConnected
- End Sub
- Private Sub Ftp1_Debug (DebugMsg As String)
- If (Ftp1.Action <> FtpActionGetDirList And Ftp1.Action <> FtpActionGetFilenameList) Then
- Trace MainForm.listTrace, DebugMsg
- End If
- End Sub
- Private Sub Ftp1_DirItem (Item As String)
- fIgnoreListDirClick = True
- Trace MainForm.listDir, Item
- fIgnoreListDirClick = False
- End Sub
- Private Sub Ftp1_Done ()
- Trace MainForm.listTrace, "done event fired"
- If (Ftp1.Action = FtpActionQuote) Then
- Trace MainForm.listTrace, CStr(Ftp1.ReadData)
- End If
- End Sub
- Sub FTP1_Progress (Bytes As Long)
- Label7.Caption = Bytes
- End Sub
- Private Sub listDir_Click ()
- Dim s As String
- Dim i As Integer
-
- If (fIgnoreListDirClick = True Or ListDir.ListIndex < 0) Then
- Exit Sub
- End If
- s = ListDir.List(ListDir.ListIndex)
- i = Len(s)
- Do While (i > 1)
- If (Mid(s, i, 1) = " ") Then
- Debug.Print Mid(s, i + 1)
- SetSelectedServerFile Mid(s, i + 1)
- If (Left(s, 1) = "d" Or Left(s, 1) = "l") Then
- If (frmLoaded Is frmDirectory) Then
- frmDirectory.txtDirectory.Text = GetSelectedServerFile()
- ElseIf (frmLoaded Is frmFileTransfers) Then
- frmFileTransfers.txtGetSrcFilename.Text = ""
- End If
- Else
- If (frmLoaded Is frmDirectory) Then
- frmDirectory.txtDirectory.Text = ""
- ElseIf (frmLoaded Is frmFileTransfers) Then
- frmFileTransfers.txtGetSrcFilename.Text = GetSelectedServerFile()
- End If
- End If
- Exit Sub
- End If
- i = i - 1
- Loop
- End Sub
- Sub LoadForm (frmNew As Form, cmdNew As CommandButton)
- If (frmNew Is frmLoaded) Then
- Exit Sub
- End If
- Load frmNew
- frmNew.Show
- If (Not frmLoaded Is Nothing) Then
- Unload frmLoaded
- cmdCurrent.FontBold = False
- End If
- cmdNew.FontBold = True
- Set frmLoaded = frmNew
- Set cmdCurrent = cmdNew
- End Sub
- Private Sub MDIForm_Load ()
- ListTrace.Height = 1500
- ListDir.Height = 1500
- DoEvents
- LoadForm frmConnection, cmdConnection
- End Sub
- Private Sub MDIForm_Resize ()
- ListTrace.Width = Me.ScaleWidth - (2 * ListTrace.Left)
- ListDir.Width = ListTrace.Width
- End Sub
- Private Sub Timer1_Timer ()
- lblLastAction.Caption = Ftp1.Action
- lblLastError.Caption = Ftp1.LastError
- lblState.Caption = Ftp1.State
- End Sub
-